/* SPDX-License-Identifier: GPL-2.0-only */

#include <mainboard/gpio.h>
#include <soc/gpio.h>

static const struct pad_config gpio_table[] = {
	PAD_CFG_NF(GPP_A0, UP_20K, PLTRST, NF1),
	PAD_CFG_NF(GPP_A1, UP_20K, PLTRST, NF1),
	PAD_CFG_NF(GPP_A2, UP_20K, PLTRST, NF1),
	PAD_CFG_NF(GPP_A3, UP_20K, PLTRST, NF1),
	PAD_CFG_NF(GPP_A4, UP_20K, PLTRST, NF1),
	PAD_CFG_NF(GPP_A5, UP_20K, PLTRST, NF1),
	PAD_CFG_NF(GPP_A6, NONE, PLTRST, NF1),
	PAD_NC(GPP_A7, NONE),
	PAD_NC(GPP_A8, NONE),
	PAD_NC(GPP_A9, NONE),
	PAD_NC(GPP_A10, NONE),
	PAD_CFG_GPI(GPP_A11, NONE, PLTRST),
	PAD_CFG_GPI(GPP_A12, NONE, PLTRST),
	PAD_CFG_GPI(GPP_A13, UP_20K, PLTRST),
	PAD_CFG_GPI(GPP_A14, UP_20K, PLTRST),
	PAD_CFG_GPI(GPP_A15, NONE, PLTRST),
	PAD_CFG_NF(GPP_A16, UP_20K, PLTRST, NF1),
	PAD_CFG_GPI(GPP_A17, UP_20K, PLTRST),
	PAD_CFG_GPI(GPP_A18, UP_20K, PLTRST),
	PAD_CFG_GPI(GPP_A19, UP_20K, DEEP),
	PAD_CFG_GPI(GPP_A20, NATIVE, DEEP),
	PAD_CFG_NF(GPP_A21, NATIVE, DEEP, NF1),
	PAD_CFG_GPI(GPP_B0, NONE, PLTRST),
	PAD_CFG_GPI(GPP_B1, NONE, PLTRST),
	PAD_CFG_GPI(GPP_B2, NONE, PLTRST),
	PAD_CFG_GPI(GPP_B3, NONE, PLTRST),
	PAD_CFG_GPI(GPP_B4, NONE, PLTRST),
	PAD_CFG_GPI(GPP_B5, NONE, PLTRST),
	PAD_CFG_GPI(GPP_B6, NONE, PLTRST),
	PAD_CFG_GPI(GPP_B7, NONE, PLTRST),
	PAD_CFG_GPO(GPP_B8, 1, PLTRST),
	PAD_CFG_GPI(GPP_B9, NONE, PLTRST),
	PAD_CFG_GPI(GPP_B10, NONE, PLTRST),
	PAD_CFG_GPI(GPP_B11, NONE, PLTRST),
	PAD_CFG_GPI(GPP_B12, NONE, PLTRST),
	PAD_CFG_NF(GPP_B13, NONE, PLTRST, NF1),
	PAD_CFG_GPI(GPP_B14, NONE, PLTRST),
	PAD_CFG_GPI(GPP_B15, NONE, PLTRST),
	PAD_CFG_NF(GPP_B16, NONE, PLTRST, NF2),
	PAD_CFG_GPI(GPP_B17, NONE, PLTRST),
	PAD_CFG_GPO(GPP_B18, 1, PLTRST),
	PAD_CFG_GPO(GPP_B19, 1, PLTRST),
	PAD_CFG_GPI(GPP_B20, NONE, PLTRST),
	PAD_CFG_GPI(GPP_B21, NONE, PLTRST),
	PAD_CFG_GPI(GPP_B22, NONE, PLTRST),
	PAD_CFG_GPI(GPP_B23, NONE, PLTRST),
	PAD_CFG_NF(GPP_C0, NONE, DEEP, NF1),
	PAD_CFG_NF(GPP_C1, NONE, DEEP, NF1),
	PAD_CFG_NF(GPP_C2, NONE, DEEP, NF1),
	PAD_CFG_GPI(GPP_C3, NONE, PLTRST),
	PAD_CFG_GPI(GPP_C4, NONE, PLTRST),
	PAD_CFG_NF(GPP_C5, UP_20K, PLTRST, NF1),
	PAD_CFG_NF(GPP_C6, UP_20K, PLTRST, NF1),
	PAD_CFG_GPI(GPP_C7, NONE, PLTRST),
	PAD_CFG_NF(GPP_C8, NONE, PLTRST, NF1),
	PAD_CFG_NF(GPP_C9, NONE, PLTRST, NF1),
	PAD_CFG_GPI(GPP_C10, NONE, PLTRST),
	PAD_CFG_NF(GPP_C11, NONE, PLTRST, NF1),
	PAD_CFG_NF(GPP_C12, NONE, PLTRST, NF1),
	PAD_CFG_GPI(GPP_C13, NONE, PLTRST),
	PAD_NC(GPP_C14, NONE),
	PAD_CFG_NF(GPP_C15, NONE, DEEP, NF1),
	PAD_CFG_NF(GPP_C16, NONE, DEEP, NF1),
	PAD_CFG_NF(GPP_C17, NONE, DEEP, NF1),
	PAD_NC(GPP_C18, NONE),
	PAD_NC(GPP_C19, NONE),
	PAD_CFG_GPI(GPP_C20, NONE, PLTRST),
	PAD_CFG_NF(GPP_C21, NONE, DEEP, NF1),
	PAD_CFG_NF(GPP_C22, NONE, DEEP, NF1),
	PAD_CFG_GPI(GPP_C23, NONE, PLTRST),
	PAD_CFG_GPO(GPP_D0, 0, PWROK),
	PAD_CFG_GPI(GPP_D1, NONE, PLTRST),
	PAD_CFG_GPI(GPP_D2, NONE, PLTRST),
	PAD_CFG_GPI(GPP_D3, NONE, PLTRST),
	PAD_CFG_GPO(GPP_D4, 1, PWROK),
	PAD_CFG_GPO(GPP_D5, 1, PLTRST),
	PAD_CFG_GPO(GPP_D6, 1, PLTRST),
	PAD_CFG_GPO(GPP_D7, 1, PLTRST),
	PAD_CFG_GPO(GPP_D8, 1, PLTRST),
	PAD_CFG_GPO(GPP_D9, 0, PWROK),
	PAD_CFG_NF(GPP_D10, NONE, PLTRST, NF1),
	PAD_CFG_NF(GPP_D11, NATIVE, PLTRST, NF1),
	PAD_CFG_NF(GPP_D12, NATIVE, PLTRST, NF1),
	PAD_CFG_NF(GPP_D13, NATIVE, PLTRST, NF1),
	PAD_CFG_GPI(GPP_D14, NONE, PLTRST),
	PAD_CFG_GPI(GPP_D15, NONE, PLTRST),
	PAD_CFG_GPI(GPP_D16, NONE, PLTRST),
	PAD_CFG_NF(GPP_D17, NONE, PLTRST, NF1),
	PAD_CFG_NF(GPP_D18, NONE, DEEP, NF1),
	PAD_NC(GPP_D19, NONE),
	PAD_CFG_NF(GPP_D20, NONE, DEEP, NF1),
	PAD_CFG_NF(GPP_D21, NONE, DEEP, NF1),
	PAD_CFG_GPI(GPP_D22, NATIVE, PLTRST),
	PAD_CFG_GPI(GPP_D23, NATIVE, PLTRST),
	PAD_CFG_GPI(GPP_E0, NONE, PLTRST),
	PAD_CFG_GPI(GPP_E1, NONE, PLTRST),
	PAD_CFG_GPI(GPP_E2, NONE, PLTRST),
	PAD_CFG_GPI(GPP_E3, NONE, PLTRST),
	PAD_CFG_GPO(GPP_E4, 0, PLTRST),
	PAD_CFG_GPO(GPP_E5, 1, PLTRST),
	PAD_CFG_GPI(GPP_E6, NONE, PLTRST),
	PAD_CFG_GPI(GPP_E7, NONE, PLTRST),
	PAD_CFG_NF(GPP_E8, NONE, PLTRST, NF1),
	PAD_CFG_GPI(GPP_E9, NONE, PLTRST),
	PAD_CFG_GPI(GPP_E10, NONE, PLTRST),
	PAD_CFG_GPI(GPP_E11, NONE, PLTRST),
	PAD_CFG_GPI(GPP_E12, NONE, PLTRST),
	PAD_CFG_GPI(GPP_E13, NONE, PLTRST),
	PAD_CFG_NF(GPP_E14, NONE, PLTRST, NF1),
	PAD_CFG_GPI(GPP_E15, NONE, PLTRST),
	PAD_CFG_NF(GPP_E16, NONE, PLTRST, NF2),
	PAD_CFG_GPI(GPP_E17, NONE, PLTRST),
	PAD_NC(GPP_E18, NONE),
	PAD_NC(GPP_E19, NONE),
	PAD_NC(GPP_E20, NONE),
	PAD_NC(GPP_E21, NONE),
	PAD_CFG_NF(GPP_E22, DN_20K, PLTRST, NF1),
	PAD_CFG_NF(GPP_F0, NONE, PLTRST, NF1),
	PAD_CFG_NF(GPP_F1, UP_20K, PLTRST, NF1),
	PAD_CFG_NF(GPP_F2, NONE, PLTRST, NF1),
	PAD_CFG_NF(GPP_F3, UP_20K, PLTRST, NF1),
	PAD_CFG_NF(GPP_F4, NONE, PLTRST, NF1),
	PAD_CFG_NF(GPP_F5, NONE, PLTRST, NF3),
	PAD_CFG_NF(GPP_F6, NONE, PLTRST, NF1),
	PAD_CFG_TERM_GPO(GPP_F7, 1, DN_20K, PWROK),
	PAD_CFG_GPI(GPP_F8, DN_20K, PLTRST),
	PAD_CFG_GPI(GPP_F9, NONE, PLTRST),
	PAD_CFG_GPI(GPP_F10, NONE, PLTRST),
	PAD_CFG_GPI(GPP_F11, NONE, PLTRST),
	PAD_CFG_GPI(GPP_F12, NONE, PLTRST),
	PAD_CFG_GPI(GPP_F13, NONE, PLTRST),
	PAD_CFG_GPI(GPP_F14, NONE, PLTRST),
	PAD_CFG_GPI(GPP_F15, NONE, PLTRST),
	PAD_CFG_GPI(GPP_F16, NONE, PLTRST),
	PAD_CFG_GPI(GPP_F17, NONE, PLTRST),
	PAD_CFG_GPI(GPP_F18, NONE, PLTRST),
	PAD_CFG_GPI(GPP_F19, NONE, PLTRST),
	PAD_CFG_GPI(GPP_F20, NONE, PLTRST),
	PAD_CFG_GPI(GPP_F21, NONE, PLTRST),
	PAD_CFG_GPI(GPP_F22, NONE, PLTRST),
	PAD_CFG_GPI(GPP_F23, NONE, PLTRST),
	PAD_CFG_GPI(GPP_H0, NONE, PLTRST),
	PAD_CFG_GPI(GPP_H1, NONE, PLTRST),
	PAD_CFG_GPI(GPP_H2, NONE, PLTRST),
	PAD_NC(GPP_H3, NONE),
	PAD_CFG_NF(GPP_H4, NONE, PLTRST, NF2),
	PAD_CFG_NF(GPP_H5, NONE, PLTRST, NF2),
	PAD_CFG_GPI(GPP_H6, UP_20K, PLTRST),
	PAD_CFG_GPI(GPP_H7, UP_20K, PLTRST),
	PAD_CFG_GPI(GPP_H8, NONE, PLTRST),
	PAD_CFG_GPI(GPP_H9, NONE, PLTRST),
	PAD_CFG_GPI(GPP_H10, NONE, PLTRST),
	PAD_CFG_GPI(GPP_H11, NONE, PLTRST),
	PAD_NC(GPP_H12, NONE),
	PAD_CFG_GPI(GPP_H13, NONE, PLTRST),
	PAD_CFG_GPI(GPP_H14, NONE, PLTRST),
	PAD_CFG_GPO(GPP_H15, 1, PLTRST),
	PAD_CFG_NF(GPP_H16, NONE, PLTRST, NF1),
	PAD_CFG_NF(GPP_H17, NONE, PLTRST, NF1),
	PAD_NC(GPP_H18, NONE),
	PAD_CFG_NF(GPP_H19, NONE, PLTRST, NF1),
	PAD_CFG_NF(GPP_H20, NONE, PLTRST, NF1),
	PAD_CFG_GPO(GPP_H21, 1, PLTRST),
	PAD_CFG_GPI(GPP_H22, NONE, PLTRST),
	PAD_CFG_GPI(GPP_S0, NONE, PLTRST),
	PAD_CFG_GPI(GPP_S1, NONE, PLTRST),
	PAD_CFG_GPI(GPP_S2, NONE, PLTRST),
	PAD_CFG_GPI(GPP_S3, NONE, PLTRST),
	PAD_CFG_GPI(GPP_S4, NONE, PLTRST),
	PAD_CFG_GPI(GPP_S5, NONE, PLTRST),
	PAD_CFG_GPI(GPP_S6, NONE, PLTRST),
	PAD_CFG_GPI(GPP_S7, NONE, PLTRST),
	PAD_CFG_NF(GPP_V0, NONE, DEEP, NF1),
	PAD_CFG_NF(GPP_V1, NONE, DEEP, NF1),
	PAD_CFG_NF(GPP_V2, NONE, DEEP, NF1),
	PAD_CFG_NF(GPP_V3, NONE, DEEP, NF1),
	PAD_CFG_NF(GPP_V4, NONE, DEEP, NF1),
	PAD_CFG_NF(GPP_V5, UP_20K, PLTRST, NF1),
	PAD_CFG_NF(GPP_V6, NATIVE, PLTRST, NF1),
	PAD_CFG_NF(GPP_V7, NATIVE, PLTRST, NF1),
	PAD_CFG_NF(GPP_V8, UP_20K, PLTRST, NF1),
	PAD_CFG_NF(GPP_V9, NONE, PLTRST, NF1),
	PAD_CFG_NF(GPP_V10, NONE, PLTRST, NF1),
	PAD_CFG_GPI(GPP_V11, NONE, PLTRST),
	PAD_NC(GPP_V12, NONE),
	PAD_CFG_NF(GPP_V13, NONE, PLTRST, NF1),
	PAD_CFG_GPI(GPP_V14, NONE, PLTRST),
	PAD_CFG_GPI(GPP_V15, NONE, PLTRST),
	PAD_CFG_GPI(GPP_V16, NONE, PLTRST),
	PAD_CFG_GPI(GPP_V17, NONE, PLTRST),
	PAD_NC(GPP_V18, NONE),
	PAD_CFG_NF(GPP_V19, NONE, PLTRST, NF1),
	PAD_NC(GPP_V20, NONE),
	PAD_NC(GPP_V21, NONE),
	PAD_NC(GPP_V22, NONE),
	PAD_NC(GPP_V23, NONE),
};

void mainboard_configure_gpios(void)
{
	gpio_configure_pads(gpio_table, ARRAY_SIZE(gpio_table));
}
